package org.jeecg.modules.iot.mqtt.server.service.processor.socketOperate;

import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ChargePileService {
    @Autowired
    private ChargePileProcessor chargePileProcessor;

    /**
     * 打开指定端口
     * @param deviceCode 设备代码
     * @param port 端口号
     * @param time 输出时间
     * @param power 输出功率
     * @param autoOpen 自启动功能
     * @return 操作序列号
     */
    public Result openPort(String deviceCode, int port, int time, int power, int autoOpen, String openId) {
        return chargePileProcessor.openPort(deviceCode, port, time, power, autoOpen, openId);
    }


    public Result openManagePort(String deviceCode, int port, int time, int power, int autoOpen) {
        return chargePileProcessor.openManagePort(deviceCode, port, time, power, autoOpen);
    }

    public Result closeManagePort(String deviceCode, int port) {
        return chargePileProcessor.closeManagePort(deviceCode, port);
    }

    /**
     * 关闭指定端口
     * @param deviceCode 设备代码
     * @param port 端口号
     * @return 操作序列号
     */
    public Integer closePort(String deviceCode, int port) {
        return chargePileProcessor.closePort(deviceCode, port);
    }

    public Integer queryPort(String deviceCode) {
        return chargePileProcessor.queryPort(deviceCode);
    }
}
